from conans import ConanFile, CMake

class MyrpcClientConan(ConanFile):
    name = "myrpcclient"
    version = "5.2.3-SNAPSHOT"
    license = "BSD-2-Clause"
    author = "unknow_author unknow_author@myhost<"
    url = "https://myhost/myrpc"
    description = "myrpc client."
    topics = ("myrpc","client","rpc")

    requires = "thrift/0.13.0", "common_source_cpp/master"
    settings = "os", "compiler", "build_type", "arch"
    options = {"fPIC": [True, False],"build_proxy": [True, False]}
    default_options = {"fPIC": True,"build_proxy": False}
    generators = "cmake","cmake_find_package"
    # Sources are located in the same place as this recipe, copy them to the recipe
    exports_sources = "CMakeLists.txt", "src/*", "cmake/config.cmake.in"

    def config_options(self):
        if self.settings.os == "Windows":
            del self.options.fPIC

    def build(self):
        cmake = CMake(self)
        cmake.configure()
        cmake.build()

    def package(self):
        cmake = CMake(self)
        cmake.install()

    def package_info(self):
        self.cpp_info.libs = ["myrpcclient"]
